//
//  SettingViewController.m
//  NewGame
//
//  Created by wwj on 15/9/22.
//  Copyright © 2015年 wwj. All rights reserved.
//

#import "SettingViewController.h"

@interface SettingViewController ()
@property (weak, nonatomic) IBOutlet UIButton *musicMutedBtn;
@property (weak, nonatomic) IBOutlet UIButton *soundBtn;

@end

@implementation SettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    BOOL musicMuted = [SoundTool sharedSoundTool].musicMuted;
    [_musicMutedBtn setTitle:musicMuted?@"音乐【关】":@"音乐【开】" forState:UIControlStateNormal];
    
    BOOL soundMuted = [SoundTool sharedSoundTool].soundMuted;
    [_soundBtn setTitle:soundMuted?@"音效【关】":@"音效【开】" forState:UIControlStateNormal];
}


#pragma mark 背景音乐点击事件
- (IBAction)onClickBgSound:(UIButton *)sender {
    BOOL musicMuted = [SoundTool sharedSoundTool].musicMuted;
    [sender setTitle:musicMuted?@"音乐【开】":@"音乐【关】" forState:UIControlStateNormal];
    [SoundTool sharedSoundTool].musicMuted = !musicMuted;
    
    [[SoundTool sharedSoundTool] playSound:kSoundClick];
}


#pragma mark 音效点击事件
- (IBAction)onClickSound:(UIButton *)sender {
    BOOL soundMuted = [SoundTool sharedSoundTool].soundMuted;
    [sender setTitle:soundMuted?@"音效【开】":@"音效【关】" forState:UIControlStateNormal];
    [SoundTool sharedSoundTool].soundMuted = !soundMuted;
    [[SoundTool sharedSoundTool] playSound:kSoundClick];
}

- (IBAction)back:(id)sender {
    [self.navigationController popViewControllerAnimated:YES];
}

@end
